﻿<views:MvxWpfView 
    x:Class="Sidvall.LogManager.UI.Wpf.Views.UserConfigurationView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:views="clr-namespace:MvvmCross.Wpf.Views;assembly=MvvmCross.Wpf"
    xmlns:vms="clr-namespace:Sidvall.LogManager.UI.ViewModels;assembly=Sidvall.LogManager.UI"
    xmlns:Controls="clr-namespace:Sidvall.LogManager.UI.Wpf.Controls" 
    xmlns:Converters="clr-namespace:Sidvall.UI.Wpf.Converters;assembly=Sidvall.UI.Wpf" 
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:local="clr-namespace:Sidvall.LogManager.UI.Wpf.Views"
    mc:Ignorable="d" 
    d:DesignHeight="600" d:DesignWidth="800">

    <views:MvxWpfView.Resources>
        <Converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <Converters:BooleanToVisibilityConverter x:Key="NotBooleanToVisibilityConverter" Not="True"/>
    </views:MvxWpfView.Resources>

    <Grid d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True, Type={x:Type vms:UserConfigurationViewModel}}">
        <Grid.Background>
            <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.InactiveBorderColorKey}}"/>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition/>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Controls:HeaderControl HeaderCaption="Settings" />

        <Grid Grid.Row="1">
            <Grid.Background>
                <SolidColorBrush Color="#FFD1E0F1" Opacity="0.6"/>
            </Grid.Background>
            <StackPanel Orientation="Horizontal">
                <Controls:ButtonControl ImageHeight="36" ImageWidth="36" ImageSource="/Sidvall.LogManager.UI.Wpf;component/Images/Save.png" 
                                        ToolTip="Save" ButtonCommand="{Binding SaveCommand}" IsEnabled="{Binding IsSavable}" />
                <Controls:ButtonControl ImageHeight="36" ImageWidth="36" ImageSource="/Sidvall.LogManager.UI.Wpf;component/Images/Refresh.png" 
                                        ToolTip="Reload" ButtonCommand="{Binding RefreshItemsCommand}" IsEnabled="{Binding IsSavable}" />
                <Controls:ButtonControl ImageHeight="36" ImageWidth="36" ImageSource="/Sidvall.LogManager.UI.Wpf;component/Images/ConnectToServer.png" 
                                        ToolTip="Connect to server" ButtonCommand="{Binding ConnectToServerCommand}" IsEnabled="{Binding CanConnectToServer}" />
                <Controls:ButtonControl ImageHeight="36" ImageWidth="36" ImageSource="/Sidvall.LogManager.UI.Wpf;component/Images/Export.png" 
                                        ToolTip="Export" ButtonCommand="{Binding ExportSettingsCommand}" />
                <Controls:ButtonControl ImageHeight="36" ImageWidth="36" ImageSource="/Sidvall.LogManager.UI.Wpf;component/Images/Import.png" 
                                        ToolTip="Import" ButtonCommand="{Binding ImportSettingsCommand}" />
            </StackPanel>
        </Grid>
        <Grid Grid.Row="2" Grid.Column="1" Grid.RowSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Grid Grid.Row="1">
                    <StackPanel>
                        <Grid Margin="5,5,5,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="130" />
                                <ColumnDefinition Width="200" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Label Content="Name"/>
                            <TextBox Grid.Column="1" Text="{Binding ActiveEntity.Name}" IsReadOnly="True" />
                        </Grid>
                        <Grid Margin="5,5,5,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="130" />
                                <ColumnDefinition Width="200" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Label Content="Start Page"/>
                            <ComboBox Grid.Column="1" SelectedValuePath="Value" DisplayMemberPath="Key" SelectedValue="{Binding ActiveEntity.StartPageId}" ItemsSource="{Binding PageTypes}" />
                        </Grid>
                        <Grid Margin="5,5,5,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="130" />
                                <ColumnDefinition Width="200" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Label Content="Show News"/>
                            <CheckBox Grid.Column="1" IsChecked="{Binding ActiveEntity.ShowNewsAtStartup}" VerticalAlignment="Center" />
                        </Grid>
                        <Grid Margin="5,5,5,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="130" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Label Content="STS Address"/>
                            <TextBox Grid.Column="1" Text="{Binding ActiveEntity.STSAddress}" />
                        </Grid>
                        <Grid Margin="5,5,5,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="130" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Label Content="STS Client Id"/>
                            <TextBox Grid.Column="1" Text="{Binding ActiveEntity.STSClientId}" />
                        </Grid>
                        <Grid Margin="5,5,5,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="130" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Label Content="STS Client Secret"/>
                            <TextBox Grid.Column="1" Text="{Binding ActiveEntity.STSClientSecret}" />
                        </Grid>
                        <Grid Margin="5,5,5,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="130" />
                                <ColumnDefinition Width="200" />
                                <ColumnDefinition Width="80" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Label Content="2-Factor Type"/>
                            <ComboBox Grid.Column="1" ItemsSource="{Binding TwoFactorProviders}" SelectedValuePath="Value" DisplayMemberPath="Key" 
                                                                  SelectedValue="{Binding ActiveEntity.TwoFactorProvider}" />
                        </Grid>
                    </StackPanel>
                </Grid>
            </Grid>
        </Grid>
    </Grid>
</views:MvxWpfView>
